package initialize

import (
	"0507zk/common/config"
	"context"
	"fmt"
	"github.com/go-redis/redis/v8"
)

var (
	Client *redis.Client
)

func Redis() {
	nas := config.Nas.Redis
	Client = redis.NewClient(&redis.Options{
		Addr:     nas.Addr,
		Password: nas.Password, // no password set
		DB:       0,            // use default DB
	})
	_, err = Client.Ping(context.Background()).Result()
	if err != nil {
		fmt.Println("redis连接失败")
		return
	} else {
	}
	fmt.Println("redis初始化成功")

}
